<template>
    <div class="ccc">
    <van-list
    v-model="loading"
    :finished="finished"
    finished-text="没有更多了"
    @load="onLoad"
    >
    <div class="cont">
        <manhua v-for="(item,i) in content" :key="i" :data="item" />
    </div>
    </van-list>
    </div>
</template>

<script>
    import manhua from '@/components/ManHuaItem.vue' 
    export default {
        data() {
            return {
                //页数标识
                num:1,
                //触底加载状态
                loading: false,
                // 数据加载状态
                finished: false,
                //展示数据
                content:[]
            }
        },
        props:['typeId'],
        components:{
            manhua
        },
        methods: {
            onLoad() {
                this.axios({
                    url:'GetHomeSecondaryComics',
                    params:{
                        moduleId:this.typeId,
                        pageNum:this.num,
                        pageSize:10
                    }
                }).then(res=>{
                    if (res.status === 200) {
                        this.content.push(...res.data.data.comics)
                        this.num += 1;
                        this.loading = false;
                        if (res.data.data.comics.length > 10) {
                            this.finished = true;
                        }
                    }
                })
            },
        },
    }
</script>

<style lang="less" scoped>
    .ccc{
        width: 100%;
        height: calc(100vh - 125px);
        overflow: auto;
    }
    .cont{
        padding: 0 10px;
        box-sizing: border-box;
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap;
    }
</style>